<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=\, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 建议直接clear:both */
        *{
            padding: 0;
            margin: 0;
        }
        .father{
            width: 800px;
            height: 1200px;
            border: 2px solid #222;
            margin: 0 auto;
        }
        h1{
            text-align: center;
        }
        .son{
            width: 600px;
            height: 1000px;
            margin: 0 auto;
            border: 2px solid yellowgreen;
        }
        span{
            margin-bottom: 10px;
        }
        span:nth-child(1){
            float: left;
            border: 1px solid red;
        }
        span:nth-child(2){
            float: right;
            border: 1px solid green;
            clear: left;
        }
        span:nth-child(3){
            float: left;
            border: 1px solid red;
            clear: right;
        }
        span:nth-child(4){
            float: right;
            border: 1px solid green;
            clear: left;
        }
        span:nth-child(5){
            float: right;
            border: 1px solid green;
            clear: right;
        }
        span:nth-child(6){
            float: left;
            border: 1px solid red;
            clear: right;
        }
        span:nth-child(7){
            float: left;
            border: 1px solid red;
            clear: left;
        }
        span:nth-child(8){
            float: right;
            border: 1px solid green;
            clear: left;
        }
        span:nth-child(9){
            float: right;
            border: 1px solid green;
            clear: right;
        }
    </style>
</head>
<body>
    <div class="father">
        <h1>搞笑聊天记录</h1>
        <div class="son">
            <span>老板有货吗？</span>
            <span>有！！！</span>
            <span>这么凶，态度不够诚恳</span>
            <span>我爱你</span>
            <span>态度够诚恳了吧</span>
            <span>老板，你这有点吓人啊</span>
            <span>再见</span>
            <span>纳尼</span>
            <span>。。。。。。。</span>
        </div>
    </div>
</body>
</html>